//
//  AboutViewController.m
//  Clock
//
//  Created by NightElf_ZC on 16/5/6.
//  Copyright © 2016年 qianfeng. All rights reserved.
//

#import "AboutViewController.h"

@interface AboutViewController ()

@end

@implementation AboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"关于作者";
    
    UIImageView * iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 120, 120)];
    iconImageView.backgroundColor = [UIColor redColor];
    [self.view addSubview:iconImageView];
    iconImageView.center = CGPointMake(self.view.frame.size.width / 2, 170);
    iconImageView.layer.cornerRadius = 60;
    iconImageView.layer.masksToBounds = YES;
    iconImageView.image = [UIImage imageNamed:@"jiushi"];
    
    UILabel * authorLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 230, self.view.frame.size.width, 70)];
    UILabel * qqLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 300, self.view.frame.size.width, 70)];
    
    authorLabel.text = @"张 晨";
    qqLabel.text = @"QQ:821712705";
    
    authorLabel.textAlignment = NSTextAlignmentCenter;
    qqLabel.textAlignment = NSTextAlignmentCenter;
    
    authorLabel.textColor = [UIColor blackColor];
    qqLabel.textColor = [UIColor blackColor];
    
    [self.view addSubview:authorLabel];
    [self.view addSubview:qqLabel];
    
    
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    // app版本
    NSString *app_Version = [NSString stringWithFormat:@"Version：%@",[infoDictionary objectForKey:@"CFBundleShortVersionString"]];
    // app build版本号
    NSString *app_build = [NSString stringWithFormat:@"Build：%@",[infoDictionary objectForKey:@"CFBundleVersion"]];
    
    for (int i = 0; i < 2; i++) {
        UILabel * label = [[UILabel alloc] initWithFrame:CGRectMake(0, (self.view.frame.size.height - 100) + i * 21 , self.view.frame.size.width, 21)];
        label.textAlignment = NSTextAlignmentCenter;
        label.text = i == 0 ? app_Version : app_build;
        label.font = [UIFont systemFontOfSize:14];
        label.textColor = [UIColor lightGrayColor];
        [self.view addSubview:label];
    }
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self setUpNav];
}

- (void)setUpNav{
    
    
    self.navigationController.navigationBar.titleTextAttributes = @{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName:[UIColor blackColor]};
    /**
     * 添加左侧返回按钮
     */
    
    self.navigationController.navigationBar.translucent = YES;
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"return"] style:UIBarButtonItemStyleDone target:self action:@selector(back)];
    self.navigationItem.leftBarButtonItem.tintColor=[UIColor blackColor];
}

-(void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
